package com.woniuxy02;

import java.util.Scanner;

/**
 * @author 作者
 * @create 2025-08-29 14:23
 */
public class Test05 {
    public static void main(String[] args) {
        int[] a={1,2,3,4,5};
        int[] b=new int[a.length];
        System.out.println("反转前:");
        for (int i: a){
            System.out.print(i+"\t");
        }
        System.out.println();
        for(int i=0;i<a.length;i++){
            b[a.length-1-i]=a[i];
        }
        a=b;
        System.out.println("反转后:");
        for (int i: a){
            System.out.print(i+"\t");
        }
        System.out.println();


        //两个元素交互
        int i=1,j=2;
        System.out.println("交换前:i="+i+",j="+j);

//        int t=i;i=j;j=t;
        int t=j;j=i;i=t;
        System.out.println("交换后:i="+i+",j="+j);


    }
}
